7 Replies - 312 Views - Last Post: 21 January 2012 - 11:15 AM

Topic Sponsor:

#1 localhost  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 121
  • Joined: 13-December 10

Load href class link

Posted 21 January 2012 - 09:28 AM

I hope this is the right category..

I got this link:
<a href='#' class='osx'>Demo</a>



How can I load that class instantly if the page loads?
Now I need to hit the link....

Thanks in advance!
Is This A Good Question/Topic? 0
  • +

Replies To: Load href class link

#2 Duckington  Icon User is online

  • D.I.C Regular

Reputation: 123
  • View blog
  • Posts: 417
  • Joined: 12-October 09

Re: Load href class link

Posted 21 January 2012 - 09:58 AM

That would style the link with the css defined in .osx{}

Not really sure what you're asking...
Was This Post Helpful? 0
  • +
  • -

#3 localhost  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 121
  • Joined: 13-December 10

Re: Load href class link

Posted 21 January 2012 - 09:59 AM

Now it works if I hit the link..
But I want to get it work without that link.

I don't know how..
Was This Post Helpful? 0
  • +
  • -

#4 xxxjj18  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 38
  • View blog
  • Posts: 126
  • Joined: 30-November 11

Re: Load href class link

Posted 21 January 2012 - 10:08 AM

This is a CSS question; not PHP.

All you have to do is declare the .osx class in the header of the page, like so:

<html>
<head>
<style type="text/css">

.osx {
  /*Here are the styles for the link */
}

/* or you could do */

a .osx {
  /* styles here */
}

</style>
</head>
<body>
<a href='#' class='osx'>Demo</a>
</body>
</html>



Or you could link to another existing css file with the same styles;

<link href="styles.css" rel="stylesheet" type="text/css" />


Was This Post Helpful? 0
  • +
  • -

#5 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1758
  • View blog
  • Posts: 2,693
  • Joined: 08-June 10

Re: Load href class link

Posted 21 January 2012 - 10:12 AM

* Moved to HTML/CSS Javascript *
Was This Post Helpful? 0
  • +
  • -

#6 localhost  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 121
  • Joined: 13-December 10

Re: Load href class link

Posted 21 January 2012 - 10:48 AM

View Postxxxjj18, on 21 January 2012 - 10:08 AM, said:

This is a CSS question; not PHP.

All you have to do is declare the .osx class in the header of the page, like so:

<html>
<head>
<style type="text/css">

.osx {
  /*Here are the styles for the link */
}

/* or you could do */

a .osx {
  /* styles here */
}

</style>
</head>
<body>
<a href='#' class='osx'>Demo</a>
</body>
</html>



Or you could link to another existing css file with the same styles;

<link href="styles.css" rel="stylesheet" type="text/css" />



Sorry!

I don't know how to explain this..

I got this code:
	<link type='text/css' href='css/osx.css' rel='stylesheet' media='screen' />
	<script type='text/javascript' src='js/jquery2.js'></script>
	<script type='text/javascript' src='js/jquery.simplemodal.js'></script>
	<script type='text/javascript' src='js/osx.js'></script>
	<input type='button' name='osx' value='Demo' id='osx' class='osx demo'/>

			<div id="osx-modal-content">
			<div id="osx-modal-title">Welcome!</div>
			<div class="close"><a href="#" class="simplemodal-close">close</a></div>
			<div id="osx-modal-data">
<button class="simplemodal-close">Close</button> <span>(or ESC)</span></p>
			</div>
		</div>
	</div>



Now I need to hit the button and then it pop-ups.. I want it without the button.

So if the page has been loaded it need to popup..

Any ideas?
Was This Post Helpful? 0
  • +
  • -

#7 localhost  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 121
  • Joined: 13-December 10

Re: Load href class link

Posted 21 January 2012 - 11:05 AM

Thank you for the help..

Finally I found my answer:
<script type="text/javascript">
$(document).ready(function () {
   $("#osx").trigger('click');
});
   </script>


Was This Post Helpful? 0
  • +
  • -

#8 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1758
  • View blog
  • Posts: 2,693
  • Joined: 08-June 10

Re: Load href class link

Posted 21 January 2012 - 11:15 AM

OK, so that button had some Javascript attached to the click event. That would have been useful information to have from the start! :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1