HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 24th, 2009, 03:15 PM
irtony irtony is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 3 irtony User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 24 sec
Reputation Power: 0
Angry JScript - General - Error - Simple for someone who knows what they are doing

Unfortunately, that's not me. I've never worked in asp and I'm working with old code that someone else wrote. Anyway, here is the problem; I have this javascript:

<script language="javascript">
function openPopup(strOpen) {
open(strOpen, "Info", "status=1, width=600, height=500, top=200, left=100");
}
</script>

I have this in the page:

<%
response.write "<a href='popup.aspx?productid="&rs_products.fields("productid") &"'> Product Information: " & "</a><br>"
%>

I have tried about ten different ways to add the popUp javascript to this piece of code, but it always causes the page to crash. Can someone tell me exactly how to do this? Thanks!

Reply With Quote
  #2  
Old June 24th, 2009, 04:49 PM
mystic7's Avatar
mystic7 mystic7 is offline
Contributing User
Click here for more information.
 
Join Date: Sep 2006
Posts: 1,480 mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 11 h 6 m 20 sec
Reputation Power: 270
Go here
http://javascript.internet.com/generators/popup-window.html

Enter your information and generate new popup code. At the very least the code in your link should look like this:
Code:
<head>
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,men  ubar=0,resizable=1,width=600,height=500,left = 540,top = 275');");
}
// End -->
</script>

For the link:
Code:
response.write "<A HREF=""javascript:popUp(""popup.aspx?productid="&rs_products.fields("productid")&")"">Product Information:</A>"


You might have to play around with the quote marks. If you can't get it, then just remove the response.write and do it like this:
Code:
%>
<A HREF="javascript:popUp(''popup.aspx?productid="&rs_products.fields("productid")')">Open the Popup Window</A>
<%

Last edited by mystic7 : June 24th, 2009 at 04:53 PM.

Reply With Quote
  #3  
Old June 25th, 2009, 07:29 AM
irtony irtony is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 3 irtony User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 24 sec
Reputation Power: 0
Thanks! I'll let you know if it works out. I can do these things in asp.net but for some reason asp baffles me.

Reply With Quote
  #4  
Old June 25th, 2009, 09:36 AM
irtony irtony is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 3 irtony User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 24 sec
Reputation Power: 0
Unhappy ok, that's not working

I implemented the code, here is the page:

the page is not throwing an error now, but when you click on the link with the popup, the url that comes up is
javascriptopUp(

I tried every way I can to rearrange the quote marks, including using single quotes, but it doesn't work? Any suggestions?

Thank you very much for helping.


----------
Code:
<!--#include file="shoppage_header.asp"-->

 <head>
     <style type="text/css">
         .style1
         {
             width: 29%;
         }
         .style2
         {
             width: 38%;
             margin-left: 36px;
         }
     </style>
</head>

 <script language="javascript">
function ChangeForm()
{
	
    	document.form2.action="displayproducts.asp?catid="+document.form2.page.value+"&page_size="+document.form2.page_size.value;
	    document.form2.submit();
	
}
     </script>
<script language="javascript">

    function popUp(URL) {
        day = new Date();
        id = day.getTime();
        eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0, scrollbars=0, location=0, statusbar=0, menubar=0, resizable=1, width=600, height=500,l eft=540, top=275');");
    }

</script>

    <script language="javascript">
        function openPopup(strOpen) {
            open(strOpen, "Info", "status=1, width=700, height=700, top=50, left=50, scrollbars=yes, resizable=1");
        }
</script>



<%
dim catid, page_size
catid = request.querystring("catid")

if request.QueryString("page_size") <> "" Then
 session("page_size") = cint(request.QueryString("page_size"))
End If 
 
If trim(session("page_size"))  = "" Then
 session("page_size")  = 25
End If

%>
	  <body>
	  <td rowspan="0" colspan="0" valign="top">
				<br>
				
				<table width="625"  border="0" style="margin-left: 48px">
				 	<form name="form2" method="post">
                  <tr>
                    <td width="25%" height="41">
					
	<%
	
	dim RsRecordTable
	%>



	<select name="page" class="pagedropdown" onChange="ChangeForm();">
	  <% 
	  
	  sql= "select categoryid, categoryname from categories order by categoryid"
	  'set rs = con.execute(sql)
	   
	 ' set RsRecordTable = server.CreateObject("adodb.recordset")
	 ' RsRecordTable.open sql, strconnect
	 
	 Set RsRecordTable = server.CreateObject("adodb.recordset") 
	 RsRecordTable.open sql, strconnect
	 
	 If catid <> "" Then
	  Dim rs_cat 
	  set rs_cat = server.CreateObject("adodb.recordset") 
	  rs_cat.open "select categoryid, categoryname from categories where categoryid='"& catid &"'", strconnect
	  if not rs_cat.eof Then 
		 response.Write"<option value="& rs_cat.fields("categoryid")&">"& rs_cat.fields("categoryname")&"</option>"	  
	  Else
	 	 response.Write"<option >--Select--</option>"
	  End If 
	  rs_cat.close
	  set rs_cat = nothing
	 End If
	  


	 while NOT RsRecordTable.eof	 
	 	If cint(catid) <> RsRecordTable.fields("categoryid") Then
 		 response.Write"<option value="& RsRecordTable("categoryid") &">"& RsRecordTable("categoryname") &"</option>"
		End If
 	 RsRecordTable.MoveNext
	 wend
	 
	 RsRecordTable.close
	 set RsRecordTable = nothing	 
        %>
		
		 </select>					</td>
                    <td class="style2">&nbsp;</td>
                    <td width="46%">
					<span class="style1"># of items:</span>					<select name="page_size" id="page_size"   onChange="ChangeForm();">
					 <% if session("page_size") = 25 Then %>
                      <option value="25">25</option>
                      <option value="75">75</option>
                      <option value="100">100</option>
					  <% elseif session("page_size") = 75 Then %>
					   <option value="75">75</option>
                       <option value="25">25</option>
                      <option value="100">100</option> 
					   <% else %>
					   <option value="100">100</option>
                      <option value="25">25</option>
                      <option value="75">75</option>
					  <% End If %>
                    </select></td>
                  </tr>
		</form>			  
                </table>

				<table  border="0" bgcolor="#EDB111" 
              style="height: 15px; width: 700px; margin-left: 48px;">
                  <tr>
                    <td width="25%"><span style="color: #FFFFFF; font-weight: bold;">&nbsp;Item</span></td>
                    <td width="53%">&nbsp;</td>
                    <td width="22%">&nbsp;</td>
                  </tr>
                </table>
				<table border="0" cellpadding="0" cellspacing="0" 
              style="width: 697px; margin-left: 48px;"  >
						 <tr>						
						  <%
							dim categoryname(10000), i
							i=0
							
							dim rs_products
							set rs_products = server.CreateObject("adodb.recordset")
							rs_products.CursorType = 1
							rs_products.open "select * from products where categoryid='"& catid &"' order by productname", strconnect
							
							'''''Paging''''''''
							DIM intPageRecords, intRecords, intRecordCount, intCurrentPage
							DIM intNumberOfPages, intDisplayPage
							intPageRecords = Request.Querystring("page")
							IF intPageRecords = "" THEN intPageRecords = 1 : intRecords = 1
							intRecords = intPageRecords
							intPageRecords = ((intPageRecords - 1) * session("page_size") ) +1
							intRecordCount = 0
							
							IF NOT rs_products.EOF THEN
							rs_products.Move (intPageRecords - 1)
							Do WHILE intRecordCount < session("page_size")  and NOT rs_products.eof

							i=i+1
						%>

						<form name="form1" id="form1" method="post" action="shopaddtocart.asp?action=add">
						
						<% If (i mod 2) = 0 then %>

						<tr bgcolor="#f7f7de">
					     <td style="margin-left: 48px">
					 <table width="381">
					 
					  <tr height="40px;">
					   <td align="left" valign="top" width="400" >
					     <% 
						   response.write rs_products.fields("productname") & "<br>"	
						' categoryname(i) = rs_products.fields("categoryname")
						 %>
					    </td>      
					    <td width="146" align="right" valign="top">
<%
response.write "<a href=""javascript:popUp(""popup.aspx?productid="&rs_products.fields("productid")&")"">Product Information:</a>"


%>						
</td>
                       </tr>
					  </table>
					  </td>
				  <td valign="top">
					<table  border="0" style="width: 95%; height: 47px">
					  <tr>
						<td width="26%" height="12" valign="bottom"><div align="right"></div></td>
						<td width="74%" rowspan="2" valign="middle">
									  <input name="orderquantity" type="text" id="orderquantity" value="1" size="2" />
									  <input name="productid" type="hidden" value="<%=rs_products.fields("productid")%>" />
									  <input name="submit2" type="image" src="Buttons/buy.jpg" width="70" height="18">
					   </td>
					  </tr>
					  <tr>
						<td height="50%"><div align="right"></div></td>
		      </tr>
			   </table>
			   
			   </td>
			
		  </tr>
		  
		  <% else %>
		  
		  <tr >
					     <td style="margin-left: 48px">
					 <table width="381">
					 
					  <tr height="40px;">
					   <td align="left" valign="top" width="400" >
					     <% 
						   response.write rs_products.fields("productname") & "<br>"	
						' categoryname(i) = rs_products.fields("categoryname")
						 %>
					    </td>      
					    <td width="146" align="right" valign="top">
			            <% 					 
					     response.write "<a href='popup.aspx?productid="&rs_products.fields("productid") &"'> Product Information: " & "</a><br>"									 
					 
						 
						%>
						</td>
                       </tr>
					  </table>
					  </td>
				  <td valign="top">
					<table height="100%"  border="0" style="width: 95%">
					  <tr>
						<td width="26%" height="12" valign="bottom"><div align="right"></div></td>
						<td width="74%" rowspan="2" valign="middle">
									  <input name="orderquantity" type="text" id="orderquantity" value="1" size="2" />
									  <input name="productid" type="hidden" value="<%=rs_products.fields("productid")%>" />
									  <input type="image" src="Buttons/buy.jpg" name="submit2">
					   </td>
					  </tr>
					  <tr>
						<td height="50%"><div align="right"></div></td>
		      </tr>
			   </table>
			   
			   </td>
			
		  </tr>
		  
		  <% End If %>
				</form>
 
 
		  
<%
				 	If (i mod 2) = 0 then
 				 	 response.write "</tr><tr>"
				 	end if 
					
					
			     	rs_products.movenext
					intRecordCount = intRecordCount +1
					Loop 
 					End if
%>
</table>
      </table>	
 		  </tr>
 		</table>

			 </td>
		</tr>
		 
			</table>
		</td>


<p align="center" style="width: 625px">
<% 
   
intCurrentPage = Request.Querystring("page")
IF intCurrentPage = "" THEN intCurrentPage = 1
intNumberOfPages = int(rs_products.RecordCount \ session("page_size") )
response.write "<br><br><br>"
IF rs_products.RecordCount MOD session("page_size") <> 0 THEN intNumberOfPages = intNumberOfPages + 1
Response.Write("<b>Pages: [</b>")
FOR intDisplayPage = 1 TO intNumberOfPages
IF Cint(intDisplayPage) = Cint(intCurrentPage) THEN
Response.Write " <b>" & intDisplayPage & "</b> "
ELSE
Response.Write " <a class=""smallredtext"" href=""displayproducts.asp?catid="& catid &"&page=" & intDisplayPage & """>" & intDisplayPage &_
"</a> "
END IF
NEXT
Response.Write ("<b>]</b>")
%>
</p>

					<% 							
					rs_products.close
					set rs_products = nothing									
					%><!--#include file="footer.asp"-->

----------

Last edited by sync_or_swim : June 26th, 2009 at 09:35 AM. Reason: Added code tags

Reply With Quote
  #5  
Old June 25th, 2009, 10:08 AM
mystic7's Avatar
mystic7 mystic7 is offline
Contributing User
Click here for more information.
 
Join Date: Sep 2006
Posts: 1,480 mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level)mystic7 User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 11 h 6 m 20 sec
Reputation Power: 270
Go to the link I gave you and generate the code yourself. I may have messed up some quote marks when I tried to rig it for a response.write. Do the code yourself and copy and paste where needed. I've never had a problem using that popup generator.

Reply With Quote
  #6  
Old June 26th, 2009, 09:41 AM
sync_or_swim's Avatar
sync_or_swim sync_or_swim is offline
Moderator
Click here for more information.
 
Join Date: Mar 2006
Location: South Wales
Posts: 3,416 sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 23 h 57 m 27 sec
Reputation Power: 1800
--> Moved to Javascript forum

Your problem is that you seem to be using the href property of the hyperlink, you need to use the onclick event, try this:
Code:
<script language="javascript">
function openPopup(strOpen) {
open(strOpen, "Info", "status=1, width=600, height=500, top=200, left=100");
}
</script>

<%
Response.Write("<a href=""#"" onclick=""javascript:openPopup('popup.aspx?productid="&rs_products.fields("productid") &"');""> Product Information</a><br>")
%>

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > JScript - General - Error - Simple for someone who knows what they are doing


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
Stay green...Green IT