ID:156715
 
So I'm trying to learn about the Browser pop-ups available in DM. I'm coming back to BYOND today for the first time in a long long time, so I'm very rusty (and I wasn't terribly good before anyway), so please be a little forgiving.

mob
Topic(href, list/href_list)
..()
var/action = href_list["action"]
var/value = href_list["value"]
switch(action)
if("Meep")
world<<"MEEP [value]"
if("Close")
src << browse(null, "window=Mee")

verb
Show_brower_text()
var/text = {"
<html>
<head>
<title>Mee</title>
<script language="javascript">
function send(action, value){
window.location="byond://?src=\ref
[src]&action="+action+"&value="+value;
}
</script>
</head>
<body>
The text inside this window has a black background, with a white font colour. <br />
The text is inside a pop-up window, which is sized 500x300.
<br />
<button disabledclick="send('Meep','a');">Meep</button>
<button disabledclick="send('Close','a');">Close</button>
</body>
</html>

"}

src << browse(text, "window=Mee;size=500x300")


That is the code I am currently using, adapted from the Unknown Person's tutorial. At the moment I can click either of the buttons, and they "click in" (graphically) but nothing else happens.

~Ease~
This isn't too related but... the [code] [/code] tags are outdated. Use [dm] [/dm] instead.
In response to Darkjohn66 (#1)
Ah thanks, I guess that shows how long I've been away from here!
Check the javascript. 'disabledclick' should be onclick
In response to Pirion (#3)
Thanks! That worked! I don't know any Javascript, so was trusting the tutorial. Weird that they used disabledclick in it if it doesn't work.

~Ease~
In response to Ease (#4)
Ease wrote:
Thanks! That worked! I don't know any Javascript, so was trusting the tutorial. Weird that they used disabledclick in it if it doesn't work.

~Ease~

I think it happened because of a security feature so that no runnable javascript gets posted in an article. It could get abused, so 'onclick' inside any tag gets turned into 'disabledclick'.
In response to Skyspark (#5)
Skyspark wrote:
Ease wrote:
Thanks! That worked! I don't know any Javascript, so was trusting the tutorial. Weird that they used disabledclick in it if it doesn't work.

~Ease~

I think it happened because of a security feature so that no runnable javascript gets posted in an article. It could get abused, so 'onclick' inside any tag gets turned into 'disabledclick'.

Ah cool, makes sense. I wish I was a bit more savvy about javascript now.