Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
code working in firefox but not IE
Old 08-27-2007, 11:30 PM code working in firefox but not IE
Junior Talker

Posts: 1
Trades: 0
This is the webpage:

Code:
<%@ Language="jscript" %>
<%if (!Session("loggedin")) { Response.Redirect("login.asp");} %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <title>Agregar Noticia</title>
    <script type="application/javascript" language="javascript">var frm="frmins"</script>
    <script type="application/javascript" language="javascript" src="scripts/forms.js"></script>
    <script type="text/javascript" language="javascript">function doSubmitImg(ds,img) {doSubmit(ds);}</script>
</head>
<body>
<form id="frmins" action="addNews.asp" method="post"  enctype="multipart/form-data">
    <fieldset style="width: 486px; text-align: left;">
        <p>
            <label for="titulo">Título:</label><br />
            <input name="titulo" id="titulo" type="text" style="width: 267px" />
        </p>
        <p>
            <label for="contenido">Contenido:</label><br />
            <textarea name="contenido" id="contenido" cols="30" rows="6"></textarea><br />
            <br />
            <label for="foto">Imagen:</label><input type="file" name="imagen" id="imagen" /><br />
            <label for="archivo">Archivo:</label><input id="archivo" name="archivo" type="file" /><br />
            <br />
            <input type="checkbox" name="destacada" id="destacada" value="true" onclick="modChkboxState(this,document.getElementById('boletin'))" /><label for="destacada">destacada</label>
            <input type="checkbox" name="deportiva" id="deportiva" value="true" /><label for="deportiva">deportiva</label>
            <input type="checkbox" name="boletin" id="boletin" value="true" onclick="modChkboxState(this,document.getElementById('destacada'))" /><label for="deportiva">Boletín</label>
            <br /><br />
            <input type="button" id="btnsubmit" onclick="doSubmitImg(eval([document.getElementById('titulo'),document.getElementById('contenido')]),document.getElementById('imagen'))" value="Agregar" />
            <input type="reset" value="Reestablecer" />
            <input type="hidden" name="codigo" id="codigo" />
        </p>
    </fieldset>
</form>
</body>
</html>
and here's the script:

Code:
// JScript File
function exists(val) {
if(!val||val==="undefined"||typeof(val)=="undefined") {
    return false;
}
return true;
}

function modChkboxState(active,other) {
    if(active.checked) {
        other.disabled="disabled";
        other.checked=null;
    } else {
        other.disabled=null;
    }
}

function doSubmit(validate) {
    var x
    for(x in validate) {
        if(!exists(validate[x].value)) {
            alert("debe especificar un "+validate[x].id);
            return;
        }
    }
    if(exists(document.getElementById("codigo"))) {
        document.getElementById("codigo").value=Date.now();
    }
    document.getElementById(frm).submit();
}
when selecting "destacado", "boletin" should disable itself and the other way around.
also I made a small script that validate's presence of text in "titulo" and "contenido". But all I get when testing on IE is an "object expected" Error.

plz help me
tijuana is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-29-2007, 06:50 PM Re: code working in firefox but not IE
logic ali's Avatar
Super Talker

Posts: 104
Trades: 0
Quote:
Originally Posted by tijuana View Post
when selecting "destacado", "boletin" should disable itself and the other way around.
That works for me on I.E., but the only values that should be assigned to .disabled and .checked are true and false.
Quote:
also I made a small script that validate's presence of text in "titulo" and "contenido". But all I get when testing on IE is an "object expected" Error.
Only Mozilla has a Date::now method; use
Code:
new Date().getTime();
Also, you must lose type='application/javascript'; it isn't globally supported and will not be viable for years to come. It will cause an error in I.E. if not changed to type='text/javascript'.
Quote:
function exists(val) {
if(!val||val==="undefined"||typeof(val)=="undefine d") {
return false;
}
return true;
}
What is this function supposed to do?

Quote:
<input type="button" id="btnsubmit" onclick="doSubmitImg(eval([document.getElementById('titulo'),document.getElem entById('contenido')]),document.getElementById('imagen'))" value="Agregar" />
There is no need to use eval to handle those parameters, and if you call the submit method instead of using a submit button, the form cannot be sent if JS is disabled.

Last edited by logic ali; 08-29-2007 at 07:43 PM..
logic ali is offline
Reply With Quote
View Public Profile
 
Old 09-03-2007, 05:01 AM Re: code working in firefox but not IE
Novice Talker

Posts: 6
Name: Mike
Trades: 0
What is this function supposed to do? I am confused.
MikeLee is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to code working in firefox but not IE
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.46272 seconds with 12 queries