...

View Full Version : problem in putting html code inside javascript



san_crazy
10-19-2008, 02:11 PM
I have the following html code snippet



<script type="text/javascript" language="javascript">

function setdetails()
{

document.write('<form id="form1" action="http://210.212.144.227/rgtu_web/results2005/results.php" method="post">)
<div id="details">
<fieldset>
<legend>Enter Your Details</legend>
<a style="position:absolute;left:20px;top:50">Roll Number :</a>
<input id="enrollNo" name="enrollNo" type="text">
<a style="position:absolute;left:20px;top:100">Branch and Stream :</a>
<select id="select2" name="tableName">
<option value="none">Please select your stream</option>
<option value="be_2">BE 2nd Semester</option> <option value="be_3">BE 3rd Semester</option>
<option value="be_4">BE 4th Semester</option> <option value="be_5">BE 5th Semester</option>
<option value="be_6">BE 6th Semester</option> <option value="be_7">BE 7th Semester</option>
<option value="be_8">BE 8th Semester</option> <option value="barch_1">B Arch 1st Semester</option>
<option value="barch_2">B Arch 2nd Semester</option> <option value="barch_3">B Arch 3rd Semester</option>
<option value="barch_4">B Arch 4th Semester</option> <option value="barch_5">B Arch 5th Semester</option>
<option value="barch_6">B Arch 6th Semester</option> <option value="barch_7">B Arch 7th Semester</option>
<option value="barch_8">B Arch 8th Semester</option> <option value="barch_9">B Arch 9th Semester</option>
<option value="barch_10">B Arch 10th Semester</option> <option value="bph_1">B Pharma 1st Semester</option>
<option value="bph_2">B Pharma 2nd Semester</option> <option value="bph_3">B Pharma 3rd Semester</option>
<option value="bph_4">B Pharma 4th Semester</option> <option value="bph_5">B Pharma 5th Semester</option>
<option value="bph_6">B Pharma 6th Semester</option> <option value="bph_7">B Pharma 7th Semester</option>
<option value="bph_8">B Pharma 8th Semester</option> <option value="mca_1">MCA 1st Semester</option>
<option value="mca_2">MCA 2nd Semester</option> <option value="mca_3">MCA 3rd Semester</option>
<option value="mca_4">MCA 4th Semester</option>
<option value="mca_5">MCA 5th Semester</option> <option value="mca_6">MCA 6th Semester</option> <option value="pg_1">ME/M.Tech. I Semester</option>
<option value="pg_2">ME/M.Tech. II Semester</option> <option value="pg_3">ME/M.Tech. III Semester</option> <option value="pg_4">ME/M.Tech. IV &amp; VI Semester</option>
<option value="pg_5">ME/M.Tech. V Semester</option> <option value="mpy_1">M.Pharma I Semester</option> <option value="mpy_2">M.Pharma II Semester</option> <option value="mpy_3">M.Pharma III Semester</option> <option value="mpy_4">M.Pharma IV Semester</option> <option value="bept_1">BE PTDC I Semester</option> <option value="bept_2">BE PTDC II Semester</option> <option value="bept_3">BE PTDC III Semester</option> <option value="bept_4">BE PTDC IV Semester</option>
</select>
<input type="submit" value="Submit" style="position:absolute;left:362px;top:200px;width:108px;height:22px;background-image:url('http://www.stripathi.110mb.com/external/images/butt.jpg');"></input>
</fieldset>
</div>
</form>')
}
</script>


when I run this, there was an error
well, i am not sure how to put this whole chunk of code inside single document.write() statement.

thanks in advance

shyam
10-19-2008, 05:25 PM
javascript is not php...literal strings cannot span multiple lines...


document.write('<form id="form1" action="http://210.212.144.227/rgtu_web/results2005/results.php" method="post">)' +
' <div id="details">' +
...

san_crazy
10-19-2008, 08:01 PM
ok...i did as you told

but there is not any effect of style block defined in <head> section for the elements in side this script like...<div>, <select>, <input>

where exactly should I put the style blocks for these elements?

san_crazy
10-20-2008, 09:13 PM
would anyone please explain it?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum