Solved

specific div display onclick

Posted on 2011-03-17
4
128 Views
Last Modified: 2012-05-11
I have the page called 'Test_Demo' that has two scripts, here are those scripts:

<script src="http://l.yimg.com/a/i/us/pps/mapbadge_1.3.js">{"pipe_id":"461b27bd06c88a959a79cadc5ef7d9ae","_btype":"map","pipe_params":{"rssurl":"http:\/\/sports.espn.go.com\/espn\/rss\/news"},"width":"740","height":"510"}</script>

<script src="http://l.yimg.com/a/i/us/pps/listbadge_1.4.js">{"pipe_id":"461b27bd06c88a959a79cadc5ef7d9ae","_btype":"list","pipe_params":{"rssurl":"http:\/\/sports.espn.go.com\/espn\/rss\/news"},"width":"740","height":"510"}</script>

Open in new window


I have two buttons on another page called 'Main', here it the code for those buttons:
<div class="list" style="left:530px; top:651px;" onClick="myIframe.location.href='scripts/Test_Demo.php';" title="List View"></div>

<div class="map" style="left:627px; top:651px;" onClick="myIframe.location.href='scripts/Test_Demo.php';" title="Map View"></div>

Open in new window


 I want to link one button from Main to one script from Test_Demo and the other button to the other script.

Is there a way I can do this with both scripts being on the same page, or do I need to separate out each script to it's own page?
0
Comment
Question by:MsKrissy
  • 2
  • 2
4 Comments
 
LVL 7

Expert Comment

by:nbove
Comment Utility
You could pass parameters to your Test_Demo page in the query string.  The scripts could then be modified to inspect the query string and execute conditionally.
0
 

Author Comment

by:MsKrissy
Comment Utility
By doing it that way do I save loading time rather then just having each script as its own page.  Then call that page?

I ask only because I'm still confused.
0
 
LVL 7

Accepted Solution

by:
nbove earned 500 total points
Comment Utility
Ultimately, it doesn't really matter if you split the scripts out into separate pages or leave them on the same page performance wise.  I would say do what makes the code look more clean and easy to manage.  If it is confusing for you to leave both scripts on the same page and execute them conditionally, then split them out into their own pages.  If it makes more sense for you to leave all of your scripts on one page and inspect a parameter to determine the appropriate script to execute, then go that route.  It really is just personal preference.
0
 

Author Closing Comment

by:MsKrissy
Comment Utility
I really wasn't given a solution, I was just give options on how to attack the issue.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now