我正在努力让Onclick在IE或Firefox中工作,但除了Chrome之外我无论如何都行不通。
<h2 onclick="javascript:window.location.href='<?php echo $cbox['read_more_url'];?>';" style="cursor: pointer;"><?php echo $cbox['title'];?></h2>
<img src="<?php echo $cbox['image']['sizes']['gallery_large'] ?>" height="<?php echo $cbox['image']['sizes']['gallery_large-height'] ?>" width="<?php echo $cbox['image']['sizes']['gallery_large-width'] ?>" alt="<?php echo $cbox['title']; ?>" onclick="javascript:window.location.href='<?php echo $cbox['title_url'];?>';" style="cursor: pointer;"/>
我也试过了location.href和window.location,但仍然没有去。这是网站http://www.tradewindgroup.com.au/代码是指3个标题构建 - 管道 - 以及它们下面的图像,它在Chrome中运行良好。
感谢
答案 0 :(得分:1)
更新您的脚本:
SHELL=/bin/bash
CC=gcc
CFLAGS=-std=c99 -g -o0
LDFLAGS=-lm
EXEC=test
BUILDDIR=build/
OBJDIR=obj/
SOURCES=$(shell cat sources.list)
OBJECTS=$(patsubst %.c,$(OBJDIR)%.o,$(notdir $(SOURCES)))
vpath %.c $(sort $(dir $(SOURCES)))
.PHONY:all mrproper clean depends
all:$(BUILDDIR)$(EXEC)
$(BUILDDIR)$(EXEC):$(OBJECTS)|$(BUILDDIR)
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
$(OBJDIR)%.o:%.c|$(OBJDIR)
$(CC) -c $< -o $@
$(BUILDDIR) $(OBJDIR):
mkdir $@
mrproper:clean
rm -f $(BUILDDIR)$(EXEC)
clean:
rm -f $(OBJECTS)
depends:
@rm -f dependencies.mk
@for i in $(SOURCES); do $(CC) -MM $$i -MT $(OBJDIR)`basename $$i | sed s:.c$$:.o:` >> dependencies.mk; done
include $(wildcard dependencies.mk)
在javascrpt中创建如下函数:
make depends
make
以下是示例:
<h2 onclick="redirectme('<?php echo $cbox['read_more_url'];?>');" style="cursor: pointer;"><?php echo $cbox['title'];?></h2>
<img src="<?php echo $cbox['image']['sizes']['gallery_large'] ?>" height="<?php echo $cbox['image']['sizes']['gallery_large-height'] ?>" width="<?php echo $cbox['image']['sizes']['gallery_large-width'] ?>" alt="<?php echo $cbox['title']; ?>" onclick="redirectme('<?php echo $cbox['title_url'];?>');" style="cursor: pointer;"/>