discuss97 Posted June 4, 2008 Share Posted June 4, 2008 Hi .I want to add javascript code in c# file . So i use private void PopUpMessege(string msg) { string popupScript = "<script language='javascript'>" + "window.alert('" + msg + "'); window.open('Default2.aspx');</script>"; //Response.Write(popupScript); Page.RegisterStartupScript("PopupScript", popupScript); }PopUpMessege("Working");This code work properly but when i use any function in script it will not fuction correctly. There are error.. plz help me private void timer() { string popupScript2 = "<script language='javascript'>" + "var seconds=0 "+ "var minutes=0 " + "document.d.d2.value='0' "+ "function display(){ "+"if (seconds>=59){ " + "seconds=0 " + "minutes+=1 "+ "if(minutes==2) "+ "{window.open('Default.aspx'); "+"} "+ "if(minutes==2) "+ "{window.open('Default.aspx'); "+ "} "+ "} "+ "else "+ "seconds+=1 "+ "document.d.d2.value=minutes+':'+seconds "+ "setTimeout('display()',100) "+ "} "+"display(); </script>"; Page.RegisterStartupScript("PopupScript2", popupScript2);} Link to comment Share on other sites More sharing options...
jesh Posted June 4, 2008 Share Posted June 4, 2008 There are error..What are those errors? Link to comment Share on other sites More sharing options...
aspnetguy Posted June 4, 2008 Share Posted June 4, 2008 sigh...please post your code for that page so we can see what "There are error" you mean. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.