| | |
javascript code not working in mozillafirefox
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2006
Posts: 14
Reputation:
Solved Threads: 0
my coding is working well in IE not in mozillafirefox
<html>
<head>
<title></title>
<script LANGUAGE="JavaScript">
function displayHTML(printContent, text2,textn)
{
var inf = printContent;
var vt2=text2
var vlabels=textn
var tablestring=''
var lnstr=text2.length;
var vrows=1.5
var vroundrows=1.25
var vprintstr=''
var vvalue=document.forms[1].fname.selectedIndex;
var vovalue=document.forms[1].fname.options[vvalue].value
var vfsize=document.forms[2].fsize.selectedIndex;
var vofsize=document.forms[2].fsize.options[vfsize].value
var vlbl=document.forms[0].lsize.selectedIndex;
var textsize=document.forms[0].lsize.options[vlbl].value
if(inf.length>30)
{
alert ("line 1 can not exceed 30 characters")
t1.value="";
t1.focus();
return;
}
if(vt2.length>30)
{
alert ("line 2 can not exceed 30 characters")
t2.value="";
t2.focus();
return;
}
win = window.open("print.html", 'popup', 'toolbar = no, status = no');
vprintstr='<a href="javascript:window.print()">Print</a> - <a href="javascript:window.close()">Close Window</a><br><br>'
win.document.write(vprintstr);
if(textsize==1)
{
vrows=vlabels/2;
}
if(textsize==2)
{
vrows=vlabels/3;
}
tablestr='<table border="1" cellspacing=10>'
for (var x = 1; x <= vrows; x++)
{
tablestr=tablestr+'<tr>'
if(textsize==1)
{
tablestr=tablestr+'<td><table width="310" height="94"><font face="'+vovalue+'" size='+vofsize+'><tr>'+ inf +'</tr><tr>'+ vt2+'</tr></table></td>'
tablestr=tablestr+'<td><table width="310" height="94"><font face="'+vovalue+'" size='+vofsize+'><tr>'+ inf +'</tr><tr>'+ vt2+'</tr></table></td>'
}
if(textsize==2)
{
tablestr=tablestr+'<td><table width="184" height="54"><font face="'+vovalue+'" size='+vofsize+'><tr>'+ inf+'</tr><tr>'+ vt2+'</tr></table></td>'
tablestr=tablestr+'<td><table width="184"height="54"><font face="'+vovalue+'" size='+vofsize+'><tr>'+ inf +'</tr><tr>'+ vt2+'</tr></table></td>'
tablestr=tablestr+'<td><table width="184"height="54"><font face="'+vovalue+'" size='+vofsize+'><tr>'+ inf +'</tr><tr>'+ vt2+'</tr></table></td>'
}
tablestr=tablestr+'</tr>'
}
tablestr=tablestr+'</table>'
win.document.write(tablestr);
}
</script>
</head>
<body bgcolor="#cfcc3b" LEFTMARGIN=40 TOPMARGIN=5>
<br><br>
<table bgcolor="#201d5b" cellspacing=5 width="900" height="10" >
<tr><td width=20 height="10"></td><td align=center><font color="#ffffff" size=7>BC Textile Innovations <br>Online I.D. Label Printer</font></td></tr>
</table>
<br>
<a href="javascript:void(0);" onclick="displayHTML(t1.value,t2.value,tn.value)"><input type="button" value="PrintPreview"></a><br>
</body>
</html>
<html>
<head>
<title></title>
<script LANGUAGE="JavaScript">
function displayHTML(printContent, text2,textn)
{
var inf = printContent;
var vt2=text2
var vlabels=textn
var tablestring=''
var lnstr=text2.length;
var vrows=1.5
var vroundrows=1.25
var vprintstr=''
var vvalue=document.forms[1].fname.selectedIndex;
var vovalue=document.forms[1].fname.options[vvalue].value
var vfsize=document.forms[2].fsize.selectedIndex;
var vofsize=document.forms[2].fsize.options[vfsize].value
var vlbl=document.forms[0].lsize.selectedIndex;
var textsize=document.forms[0].lsize.options[vlbl].value
if(inf.length>30)
{
alert ("line 1 can not exceed 30 characters")
t1.value="";
t1.focus();
return;
}
if(vt2.length>30)
{
alert ("line 2 can not exceed 30 characters")
t2.value="";
t2.focus();
return;
}
win = window.open("print.html", 'popup', 'toolbar = no, status = no');
vprintstr='<a href="javascript:window.print()">Print</a> - <a href="javascript:window.close()">Close Window</a><br><br>'
win.document.write(vprintstr);
if(textsize==1)
{
vrows=vlabels/2;
}
if(textsize==2)
{
vrows=vlabels/3;
}
tablestr='<table border="1" cellspacing=10>'
for (var x = 1; x <= vrows; x++)
{
tablestr=tablestr+'<tr>'
if(textsize==1)
{
tablestr=tablestr+'<td><table width="310" height="94"><font face="'+vovalue+'" size='+vofsize+'><tr>'+ inf +'</tr><tr>'+ vt2+'</tr></table></td>'
tablestr=tablestr+'<td><table width="310" height="94"><font face="'+vovalue+'" size='+vofsize+'><tr>'+ inf +'</tr><tr>'+ vt2+'</tr></table></td>'
}
if(textsize==2)
{
tablestr=tablestr+'<td><table width="184" height="54"><font face="'+vovalue+'" size='+vofsize+'><tr>'+ inf+'</tr><tr>'+ vt2+'</tr></table></td>'
tablestr=tablestr+'<td><table width="184"height="54"><font face="'+vovalue+'" size='+vofsize+'><tr>'+ inf +'</tr><tr>'+ vt2+'</tr></table></td>'
tablestr=tablestr+'<td><table width="184"height="54"><font face="'+vovalue+'" size='+vofsize+'><tr>'+ inf +'</tr><tr>'+ vt2+'</tr></table></td>'
}
tablestr=tablestr+'</tr>'
}
tablestr=tablestr+'</table>'
win.document.write(tablestr);
}
</script>
</head>
<body bgcolor="#cfcc3b" LEFTMARGIN=40 TOPMARGIN=5>
<br><br>
<table bgcolor="#201d5b" cellspacing=5 width="900" height="10" >
<tr><td width=20 height="10"></td><td align=center><font color="#ffffff" size=7>BC Textile Innovations <br>Online I.D. Label Printer</font></td></tr>
</table>
<br>
<a href="javascript:void(0);" onclick="displayHTML(t1.value,t2.value,tn.value)"><input type="button" value="PrintPreview"></a><br>
</body>
</html>
Last edited by sujagr8; Jul 13th, 2006 at 9:38 am.
Firefox has a built in JavaScript console. Use it to see where the error is. It will tell you what line is causing the error and what kind of error it is.
That code looks very old, too. Not a big surprise it doesn't work in Firefox.
That code looks very old, too. Not a big surprise it doesn't work in Firefox.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
•
•
Join Date: Jul 2006
Posts: 14
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by stymiee
Firefox has a built in JavaScript console. Use it to see where the error is. It will tell you what line is causing the error and what kind of error it is.
That code looks very old, too. Not a big surprise it doesn't work in Firefox.
Thank a lot for your quick response.In mozilla new window is not at all opening
Thanks & Regards
Sujagr8
Sujagr8
The code you have posted refences form fields and variables that do not exist in the code you posted. For us, the code can never work. If you want us to help you track down the problem you will need to provide the full content of the page in question, or a link to it.
If I've been a help please confirm by clicking the Add to Lafinboy's Reputation link in the header of this reply.
Lafinboy Productions
:: Website Design :: Website Development ::
Lafinboy Productions
:: Website Design :: Website Development ::
•
•
Join Date: Jul 2006
Posts: 14
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Lafinboy
The code you have posted refences form fields and variables that do not exist in the code you posted. For us, the code can never work. If you want us to help you track down the problem you will need to provide the full content of the page in question, or a link to it.
thanks a lot for your response. i got the result
Thanks & Regards
Sujagr8
Sujagr8
![]() |
Similar Threads
- "i want used confirm in javascript in code behind" (ASP.NET)
- Passing data from forms from one page to another (JavaScript / DHTML / AJAX)
- Inserting dynamic values into Javascript variables (JavaScript / DHTML / AJAX)
- Using Javascript code in ASP.NET (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: javascript:show('newsmsgid');
- Next Thread: Var value is not passed
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child close column createrange() css cursor decimal dependent design disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms google gwt gxt hiddenvalue highlightedword hint html htmlform ie8 iframe images index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl listbox math media microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php player post problem progressbar regex runtime scroll search security select shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n






