|
Hi,
In jsp and I guess in other "smart" html scripting languages there is a way to write "normal" html code inside script. For example, I can write something like:
<br />
<br />
<HTML><br />
<BODY><br />
#start_script<br />
if(some condition)<br />
{<br />
#stop_script<br />
<h1>Hello </h1><br />
#start_script<br />
}<br />
else<br />
{<br />
#stop_script<br />
<h3>World</h3><br />
#start_script<br />
}<br />
#stop_script<br />
</BODY><br />
</HTML><br />
<br />
This parts of the html are conditional and I don't have to use lot of document.write statements. Can I do this somehow with java script?
Thanks,
Yariv
|
|
|
|
|
Yariv wrote: Can I do this somehow with java script?
Do what? Not use document.write() ? By all means, please do not use it. It is eviiiil.
That said, no, there's no good way to use client-side JS the way you'd use a server-side template language. They're kinda meant for different things - what's wrong with leaving the bulk HTML generation to server-side JSP/PHP/etc.?
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
Shog9 wrote: what's wrong with leaving the bulk HTML generation to server-side JSP/PHP/etc?
Hmmmm...because I don't have server.
I'm using html as UI for mfc as template. I generate an xml island in the html page, as database, and therefor want the html code to skip or display parts according to the xml data. Since I'm generating the html in my code it's not a big deal to use document.write all over the html, but since I don't know javascript well, I thought to ask if there is a client side solution to "conditional html".
Thanks for your help,
Yariv
|
|
|
|
|
Yariv wrote: I'm using html as UI for mfc as template.
Oh. So, what, you're embedding MSHTML in your desktop app?
That actually makes it a good deal easier - generating HTML in native code is much, much faster than using Javascript.
I recommend using XSLT to develop templates that will transform your XML into HTML, and then loading that.
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
Yariv wrote: In jsp and I guess in other "smart" html scripting languages there is a way to write "normal" html code inside script
Yariv wrote: and I don't have to use lot of document.write statements. Can I do this somehow with java script?
You can use inline HTML in Server side Javascript ( if you have a server that provides a Javascript engine) but document.write is part of the Object Model of the browser and is therefore Client Side.
led mike
|
|
|
|
|
I am doing an application in which i want to put some images and under them comes a text... On clicking the text it should go to the website....
Here is the sample code attached.....The innerhtml is given "GoTo Website" and on clicking that it should redirect to the website...and it use javascript...
Can anyone please help me do this........
Thanks in advance
SAJAN A PILLAI
ASP.NET,C#.NET Programmer
dWise Solutions and Services Pvt Ltd.
BANGALORE
"Winners don't do different things. They do things differently. ...
modified on Sunday, April 6, 2008 1:32 AM
|
|
|
|
|
sajan ss wrote: SAJAN A PILLAI
ASP.NET,C#.NET Programmer
dWise Solutions and Services Pvt Ltd.
BANGALORE
You want to know how to create an anchor tag ? Either you're not serious, or this represents a new low in Indian contract development.
Perhaps you need to explain better. You want to create the link using javascript, or you have a reason for wanting to use javascript to redirect ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: Either you're not serious, or this represents a new low in Indian contract development.
I think we're running out of low at this point but that is still hilarious
"Either you're not serious, or this represents a new low in Indian contract development."
Christian Graus - in the Web Development forum
|
|
|
|
|
led mike wrote: I think we're running out of low at this point
Checked the article submissions lately? How about the comments attached that praise them...!
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
*sigh* I know....
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
sajan ss wrote: ASP.NET,C#.NET Programmer
sajan ss wrote: Here is the sample code attached.....
hmm still finding attachment
The Stifler
--
Bugs can neither be created nor be removed from software by a developer. They can only be converted from one form to another. The total number of bugs in the software always remain constant.
|
|
|
|
|
How to Fill Area of coords with different colors in Image. When mouseover on that Area.
Codes:
Please soon
Mohan Balal
--------------
(Sr.Software Engineer)
|
|
|
|
|
Hi all,
I am trying to learn how to layout my webpage using tables, so I decided to create a short simple webpage for the purpose. The page consists of the header which was created using a table with three columns, and the Main part of the page which was also created using a three column table. The Main part is right below the header. The second column of the Main part has a two column table inserted in it. The problem that I have is that when I view the page in FireFox, the table in the second column of the Main part gets pushed up into the second column of the header. However if I view the page in IE, the table in the second column of the Main Part is where I wanted it to be. Can someone please show me how to get the table to be in the same location no matter what browser I view the page in? Below is my HTML tags and thank you in advance for your time.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>
Welcome2
</title>
<style>
body {margin:0px 10px 0px 10px; padding:0px;}
a:link {color:#df7618;text-decoration:none}
a:active {color: Red}
a:visited {color:orange;font-family:arial, verdana, sans-serif; /* ADDED */}
a:hover {background:#7A5DC7;color:yellow;}
</style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" style="z-index: 100; left: 0px;
width: 1024px; position: absolute; top: 0px; height: 101px">
<tr>
<td style="width: 109px;background-color:purple"></td>
<td style="width: 806px; font-style:italic; font-size:56px;background-color:blue; color: orange; text-align:center;">Welcome</td>
<td style="width: 109px; background-color:purple"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="z-index: 101;left:0px;width:1024px;position: absolute; top: 101px; height: 140px">
<tr>
<td style="width: 109px; background-color:purple"> </td>
<td style="width: 806px; background-color:black">
<table border="1" cellpadding="0" cellspacing="0" style="z-index: 101;width:790px;left: 117px; font-size:16px; position:absolute;height:101px;top ">
<tr >
<td style="width: 147px;height:26px;color:white; text-align:center ">
<A href="Home.html">Home</A></td>
<td style="width: 147px;color:white; height:26px; text-align:center">
<A href="AboutUs.html">About Stuff</A></td>
</tr >
<tr>
<td style="width: 147px;color:white; height:34px; text-align:center ">
<A href="Subscribe.html">Trial</A></td>
<td style="width: 147px;color:white; height:33px; text-align:center ">
<A href="Current.html">Current Stuff</A></td>
</tr>
<tr>
<td style="width: 147px;color:white; height:34px; text-align:center ">
<A href="Locations.html">Pick Up Locations</A></td>
<td style="width: 147px;color:white; height:34px; text-align:center ">
<A href="stuf.html">Stuff</A></td>
</tr>
</table>
</td>
<td style="width: 109px; background-color:purple"> </td>
</tr>
</table>
</body>
</html>
<div class="ForumMod">modified on Saturday, April 5, 2008 3:43 AM</div>
|
|
|
|
|
I see the page rendered similarly in IE7 and FireFox 2. So, I am not able to figure out what difference you see.
----
In the new scheme of things, pages are supposed to be laid out using div tags.
http://www.w3.org/2002/03/csslayout-howto[^]
There are many other tutorials on the Internet.
modified 29-Aug-18 21:01pm.
|
|
|
|
|
How to change the browser icon in address bar?
|
|
|
|
|
|
I want add a row to the table dynamically using JavaScript code. In one my application it works fine. But in this application it is prompting error to IE 'unknown runtime error.'.
I have use css style sheet in this project. I am not able to find the exact cause and solution of problem.
This is an classic asp. I request you all to please help me out to find the solution.
I am provide original code of the page:
-----------------------------------------------------------------------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="dsp/include/includedb.asp"-->
<!--#include virtual="dsp/include/checkLogin.asp"-->
<%
dim rsItem, strSql, strItem
set rsItem = Server.CreateObject("ADODB.RecordSet")
strSql = "SELECT * FROM iteam_MSt WHERE status=true;"
rsItem.Open strSql, con, 1, 3
do until rsItem.EOF
strItem = strItem & "<option value='" & rsItem.Fields("iteam_ID") & "-" & rsItem.Fields("price") &"-" & rsItem.Fields("iteam_Code") &"'>" & rsItem.Fields("details") & "</option>" & vbCrLf
rsItem.MoveNext
loop
rsItem.Close
set rsItem = nothing
con.close
set con = nothing
%>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>New Purchase</title>
<link href="../include/dsp.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var ct = 1;
function CmdAdd_onclick() {
var newTable,startTag,endTag;
newTable = "";
startTag = "";
endTag = "";
var trContents0, trContents1, trContents2, trContents3, trContents4, trContents5, trContents6;
ct = ct + 1;
//Creating a new table
startTag+= "<table width='100%' border='0' cellspacing='0' cellpadding='2'>"
startTag+="<tr>"
startTag+="<td width='2%'>No</td>"
startTag+="<td width='28%'>Product Name</td>"
startTag+="<td width='17%'>Product Code</td>"
startTag+="<td width='10%'>Price</td>"
startTag+="<td width='15%'>Quantity</td>"
startTag+="<td colspan='2'>Total Amount</td>"
startTag+="</tr>"
startTag+="<tr>"
startTag+="<td colspan='7'></td>"
startTag+="</tr>"
endTag = "<tr><td colspan='7'></td></tr>"
endTag +="<tr><td colspan='5'><div align='right'>Grand Total</div></td><td colspan='2'><input name='txtGrndTotal' type='text' id='txtGrndTotal' style='font-size:12px; border:0px;' value='' size='20' readonly='readonly' /></td></tr>"
endTag +="<tr><td colspan='7'></td></tr>"
endTag +="<tr><td colspan='7'><input type='submit' name='Submit' value='Create Final Bill' /></td></tr></table>"
newTable=startTag;
var opt;
//Get the row contents
trContents0=document.getElementsByName('txtno');
trContents1=document.getElementsByName('cmbProduct');
trContents2=document.getElementsByName('txtCode');
trContents3=document.getElementsByName('txtPrice');
trContents4=document.getElementsByName('txtQty');
trContents5=document.getElementsByName('txtTotAmnt');
//trContents6=document.getElementsByName('txtGrndTotal');
//opt=document.getElementById('LstProdNo');
if(trContents1.length > 0)
{
for(i=0;i<trContents1.length;i++)
{
if(trContents1(i).innerHTML)
{
// newTable+="<TR><TD style=\"WIDTH: 120px\" ><input name=\"txtno\" type=\"text\" readonly=\"readonly\" size=\"5\" value='" + trContents0(i).value + "'/>" +"</TD>";
// newTable+="<TD style=\"WIDTH: 120px\" ><select name=\"LstProdNo\" id=\"userid\">" + trContents1(i).innerHTML + "</select>" +"</TD>";
// newTable+="<TD style=\"WIDTH: 120px\" ><input name=\"TxtQty\" type=\"text\" id=\"username\" value='" + trContents2(i).value + "'/>" +"</TD>";
// newTable+="<TD style=\"WIDTH: 120px\" ><input name=\"TxtPrice\" type=\"text\" id=\"department\" value='" + trContents3(i).value + "'/>" +"</TD><TR>";
newTable+="<tr>"
newTable+="<td><input name=\"txtNo\" type=\"text\" id=\"txtNo\" style=\"font-size:12px; border:0px;\" size=\"4\" readonly=\"readonly\" value='" + trContents0(i).value + "'/></td>"
newTable+="<td><select name=\"cmbProduct\" id=\"cmbProduct\" style=\"font-size:12px;\">" + trContents1(i).innerHTML + "</select></td>"
newTable+="<td><input name=\"txtCode\" type=\"text\" id=\"txtCode\" style=\"font-size:12px; border:0px;\" readonly=\"readonly\" value='" + trContents2(i).value + "' /></td>"
newTable+="<td><input name=\"txtPrice\" type=\"text\" id=\"txtPrice\" style=\"font-size:12px; border:0px;\" size=\"5\" readonly=\"readonly\" value='" + trContents3(i).value + "' /></td>"
newTable+="<td><input name=\"txtQty\" type=\"text\" id=\"txtAmnt\" style=\"font-size:12px;\" size=\"5\" value='" + trContents4(i).value + "' /></td>"
newTable+="<td width=\"19%\"><input name=\"txtTotAmnt\" type=\"text\" id=\"txtTotAmnt\" style=\"font-size:12px; border:0px;\" size=\"10\" readonly=\"readonly\" value='" + trContents5(i).value + "'/></td>"
newTable+="<td width=\"9%\"> </td>"
newTable+="</tr>"
}
}
}
//Add the Latest row
/*newTable+="<TR><TD style=\"WIDTH: 120px\" ><input name=\"txtno\" type=\"text\" readonly=\"readonly\" size=\"5\" value='" + ct + "'/>" +"</TD>";
newTable+="<TD style=\"WIDTH: 120px\" ><select name=\"LstProdNo\" id=\"userid\">" + opt.innerHTML + "</select>" +"</TD>";
newTable+="<TD style=\"WIDTH: 120px\" ><input name=\"TxtQty\" type=\"text\" id=\"username\" value=\"0\" />" +"</TD>";
newTable+="<TD style=\"WIDTH: 120px\" ><input name=\"TxtPrice\" type=\"text\" id=\"department\" value=\"0\"/>" +"</TD><TR>";*/
newTable+="<tr>"
newTable+="<td><input name=\"txtNo\" type=\"text\" id=\"txtNo\" style=\"font-size:12px; border:0px;\" size=\"4\" readonly=\"readonly\" value='" + ct + "'></td>"
newTable+="<td><select name=\"cmbProduct\" id=\"cmbProduct\" style=\"font-size:12px;\">" + trContents1(0).innerHTML + "</select></td>"
newTable+="<td><input name=\"txtCode\" type=\"text\" id=\"txtCode\" style=\"font-size:12px; border:0px;\" readonly=\"readonly\" /></td>"
newTable+="<td><input name=\"txtPrice\" type=\"text\" id=\"txtPrice\" style=\"font-size:12px; border:0px;\" size=\"5\" readonly=\"readonly\" /></td>"
newTable+="<td><input name=\"txtQty\" type=\"text\" id=\"txtAmnt\" style=\"font-size:12px;\" size=\"5\" /></td>"
newTable+="<td width=\"19%\"><input name=\"txtTotAmnt\" type=\"text\" id=\"txtTotAmnt\" style=\"font-size:12px; border:0px;\" size=\"10\" readonly=\"readonly\" /></td>"
newTable+="<td width=\"9%\"><input type=\"button\" name=\"Button\" value=\"ADD Product\" onclick=\"CmdAdd_onclick();\"/></td>"
newTable+="</tr>"
newTable+=endTag;
//Update the Previous Table With New Table.
document.getElementById('mainTbl').insertAdjacentHTML;
document.getElementById('mainTbl').innerHTML=newTable;
}
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" class="Head1">Buy Products</td>
</tr>
<tr>
<td class="smlTbLine1"></td>
</tr>
<tr>
<td><form id="form1" name="form1" method="post" action="">
<table width="100%" border="0" cellpadding="2" cellspacing="0" id="mainTbl">
<tr>
<td width="2%" class="reportHead3">No</td>
<td width="28%" class="reportHead3">Product Name </td>
<td width="17%" class="reportHead3">Product Code </td>
<td width="10%" class="reportHead3">Price</td>
<td width="15%" class="reportHead3">Quantity</td>
<td colspan="2" class="reportHead3">Total Amount </td>
</tr>
<tr>
<td colspan="7" class="smlTbLine"></td>
</tr>
<tr>
<td><input name="txtNo" type="text" id="txtNo" style="font-size:12px; border:0px;" value="1" size="4" readonly="readonly"/></td>
<td><select name="cmbProduct" id="cmbProduct" style="font-size:12px;">
<%=strItem%>
</select> </td>
<td><input name="txtCode" type="text" id="txtCode" style="font-size:12px; border:0px;" readonly="readonly" /></td>
<td><input name="txtPrice" type="text" id="txtPrice" style="font-size:12px; border:0px;" value="1" size="5" readonly="readonly" /></td>
<td><input name="txtQty" type="text" id="txtQty" style="font-size:12px;" size="5" /></td>
<td width="19%"><input name="txtTotAmnt" type="text" id="txtTotAmnt" style="font-size:12px; border:0px;" size="10" readonly="readonly" /></td>
<td width="9%"><input type="button" name="Button" value="ADD Product" onclick="CmdAdd_onclick();"/></td>
</tr>
<tr>
<td colspan="7" class="smlTbLine"></td>
</tr>
<tr>
<td colspan="5" class="reportHead3"><div align="right">Grand Total </div></td>
<td colspan="2"><input name="txtGrndTotal" type="text" id="txtGrndTotal" style="font-size:12px; border:0px;" value="" size="20" readonly="readonly" /></td>
</tr>
<tr>
<td colspan="7" class="smlTbLine"></td>
</tr>
<tr>
<td colspan="7"><input type="submit" name="Submit" value="Create Final Bill" /></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td class="smlTbLine1"></td>
</tr>
</table>
</body>
</html>
Kiran Sajanikar
Software Engineer
Pune.
|
|
|
|
|
Boil it down to the smallest possible amount of code necessary to reproduce the problem. The stuff you've posted has a fair bit of commented-out code, do-nothing code, and code that depends on your particular scenario (and so cannot be used to reproduce the problem by anyone here who might be interested in doing so.)
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
innerHTML does not work well with tables in IE. Firefox works well with it though. I am not sure whether innerHTML was intended to work with nested elements.
I found that out when I tried this:
table_ref = document.getElementById(table_name);
row_innerHTML = table_ref.rows[1].innerHTML;
new_row_ref = table_ref.insertRow(table_ref.rows.length);
new_row_ref.innerHTML = row_innerHTML;
The line in block letters produced a runtime error in IE.
So, I replaced it with:
table_ref = document.getElementById(table_name);
var table_row_ref = table_ref.rows[1];
new_row_ref = table_ref.insertRow(table_ref.rows.length);
cellcount = table_row_ref.cells.length;
for (cellindex = 0; cellindex < cellcount; ++cellindex)
{
new_col_ref = table_row_ref.cells[cellindex].cloneNode(true);
new_row_ref.appendChild(new_col_ref);
}
Instead of trying to use HTML code, you may also have to use insertRow(), insertColumn() etc. If you want to remove existing rows, use deleteRow() function.
modified 29-Aug-18 21:01pm.
|
|
|
|
|
see wheather any nonexisting control is referenced
|
|
|
|
|
Dear All
Please see code below:
<title>Untitled Page
function Upload_Click(){
document.getElementById('upload').click();
}
when click upload button, dialog will show up in Internet Explorer. But in firefox this dialog is not show. Who can help me? or suggest your idea for this case.
Thanks and best regards.
|
|
|
|
|
Firefox doesn't support triggering the click event for file input elements programatically. See here: http://www.quirksmode.org/dom/inputfile.html[^]
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
Hi all,
Well the project i developed, i am using reportviewer and rdlc files to display charts as an image. But my client is not very much happy about the look and feel of the images.
Can anyone suggest a good charting tool that i can use.
It should give me a nice look and feel on the images kinda 3d and stuff!
Can buy it the client has approved!
Anyone whose used a charting tool thats good and suitable?
Any help is much appreciated!!
Thanks in advance!
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|
|
Dundas charts are very good.
|
|
|
|
|
Hi,
Can someone help me with this -
I've used ASP.NET Ajax in my forms, I've created delegates and bind them with their respective handlers by defining their
events. I've a main form over which I've taken some Iframes to show different forms. I am using Ajax timer on one of my
forms in an iframe, now everything goes fine till there is no popup i.e. the events are fired properly and the code written
in their resp. handlers to change label text property works fine and the changes can be seen without a page refresh.
The problem occurs when I try to fire the event from a popup window from an IFrame on some other Iframe. Major issue
is that the event get fired and the handler changes the text value but the changes can not be seen on the page, remember
that the form in which the changes should be shown is in some other Iframe.
May be this is happening due to the form in which label's text has to be changed didn't get refresh and the Ajax
timer used is not able to revert to the changes after the focus on the current window has been lost. I don't know why this
is happening but it has been a really hectic task to overcome this situation.
Can some one has some solution or can some one help me to know a way to refresh a page in some other iframe from a
popup opened from some different iframe on the same page.
Plz try to forget my mistakes in English and Thx in advance....
Leap before you look...
|
|
|
|